package me.goldze.mvvmhabit.bus.event;

import android.arch.lifecycle.LifecycleOwner;
import android.arch.lifecycle.Observer;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;

public class SnackbarMessage extends SingleLiveEvent<Integer> {

    public interface SnackbarObserver {
        void onNewMessage(@StringRes int i);
    }

    public void observe(LifecycleOwner owner, final SnackbarObserver observer) {
        super.observe(owner, new Observer<Integer>() {
            /* class me.goldze.mvvmhabit.bus.event.SnackbarMessage.AnonymousClass1 */

            public void onChanged(@Nullable Integer t) {
                if (t != null) {
                    observer.onNewMessage(t.intValue());
                }
            }
        });
    }
}
